@extends('layout.admin')

@section('title', '管理员')

@section('content')
    <style>
        .list-content{
            background-color: #fff;
            max-width: 100%;
            flex: 0 0 100%;
            padding: 0 10px;
        }

        .list-content .list-table{
            padding-left: 18px;
            padding-right: 18px;
            max-width: 100%;
            overflow-x: auto;
        }

        .list-content .list-table .table{
            min-width: 1100px;
        }

    </style>
    <div class="list-content">
        {{--头部--}}
        @include('shared.adminListHeader',[
        'listName'=>'管理员列表',
        'svgIconName' => 'people',
        'listAddUrl' => url('admin/user/edit'),
        ])

        {{--列表头部--}}
        @include('shared.adminListTableHeader', [
            'searchData' => isset($searchData) ? $searchData : [],//搜索值
            'listObject' => isset($listObject) ? $listObject : new stdClass,//数据对象
            'currentWebsite' => url('admin/user/index'),//返回当前列表的url
            'listTableActionsUrl' => url('admin/user/batchActions'),//批量操作url
            'searchForm' => 'admin.user.search.user',//头部自定义搜索的view
            'batchActions' => 'admin.user.search.userListHeaderActions',//头部自定义批量操作选项的view
        ])

        <div class="list-table">
            <form id="listTableForm">
                <table class="table table-bordered">
                    <thead class="thead-dark">
                    <tr>
                        <th scope="col" style="width: 40px;">
                            <input type="checkbox" class="" id="listCheckboxIds"></th>
                        <th scope="col" style="width: 80px;">id</th>
                        <th scope="col" style="width: 140px;">登录名称</th>
                        <th scope="col" style="width: 100px;">状态</th>
                        <th scope="col" style="width: 80px;">姓别</th>
                        <th scope="col" style="width: 120px;">呢称</th>
                        <th scope="col" style="width: 140px;">手机号码</th>
                        <th scope="col" style="width: 120px;">姓名</th>
                        <th scope="col" style="width: 120px;">英文名</th>
                        <th scope="col" style="width: 120px;">职称</th>
                        <th scope="col" style="width: 120px;">角色</th>
                        <th scope="col" style="width: 150px;">最后登陆日期</th>
                        <th scope="col" style="width: 120px;">创建日期</th>
                        <th scope="col" style="width: 200px;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @if(isset($listObject) && $listObject->total() > 0)
                        @foreach($listObject as $listVal)
                            @if(1 != $listVal->is_administrator['value'])
                                <tr>
                                    <td style="width: 40px;">
                                        <input type="checkbox" class="" name="ids[]" value="{{$listVal->id}}">
                                    </td>
                                    <td style="width: 80px;">
                                        {{$listVal->id}}
                                    </td>
                                    <td style="width: 100px;">{{$listVal->name}}</td>
                                    <td style="width: 140px;">{{$listVal->status['name']}}</td>
                                    <td style="width: 80px;">{{$listVal->sex['name']}}</td>
                                    <td style="width: 120px;">{{$listVal->nickname}}</td>
                                    <td style="width: 140px;">{{$listVal->phone}}</td>
                                    <td style="width: 120px;">{{$listVal->real_name}}</td>
                                    <td style="width: 120px;">{{$listVal->en_name}}</td>
                                    <td style="width: 120px;">{{$listVal->position}}</td>
                                    <td style="width: 120px;">{{isset($listVal->role->name)?$listVal->role->name:''}}</td>
                                    <td style="width: 150px;">{{$listVal->last_login_time}}</td>
                                    <td style="width: 120px;">{{$listVal->created_at}}</td>
                                    <td style="width: 200px;">
                                        <a id="listAdminDelete" data-url="{{url('admin/user/deleteRole')}}" data-id="{{$listVal->id}}" href="#">删除</a>
                                        <a href="{{url('admin/user/edit', ['id'=>$listVal->id])}}">修改</a>

                                    </td>
                                </tr>
                            @endif
                        @endforeach
                    @else
                        <tr>
                            <td colspan="14" class="text-muted" style="text-align: center;font-size: 20px;padding: 20px 0;">
                                暂无数据
                            </td>

                        </tr>
                    @endif

                    </tbody>
                </table>
            </form>
        </div>
    </div>
@endsection
